﻿using System.Activities;
using System.Activities.Tracking;
using System.Collections;
using System.ComponentModel;
using System.Data;
using SLS.ExClassLib.Data;
using SLS.ExClassLib.Message;
using SLS.DataBase;
using SLS.ExClassLib.WFActivities;
namespace SLS.ExClassLib.MVVM
{ 
    /// The ATM view model interface
    /// </summary>
    /// <remarks>
    /// Implement this interface to provide a UI for the ATM Machine
    /// </remarks>
    public interface IDataModel : INotifyPropertyChanged
    {
        #region Properties 
   
        string BaseTable
        {
            get;
            set;
        }
        bool IsLoadSet5KeyDef
        {
            get;
            set;
        }
        bool IsLoadSet4Reference
        {
            get;
            set;
        }
        bool IsLoadSet2Create
        {
            get;
            set;
        }
        string HostAddress
        {
            get;
            set;
        }
        SLDBSET SetGlobal
        {
            get;
        }
        DataTable TBForeignKeyList
        {
            get;
        }
        SLDBSET SetUI
        { get; set; }
        SLDBSET SetEnv
        { get; set; }
        SLDBSET GlobalDataSet
        { get; }
        SLQDBSET SetUQ
        { get; set; }
        SLQDBSET SetQuery { get; }
        WFMachine WFMachine { get; set; }
        /// <summary>
        ///   Gets TrackingParticipant.
        /// </summary>
        TrackingParticipant TrackingParticipant { get; } 
        Activity WFActivity { get; set; }
 
        bool IsCheckDataQuality { get; set; }
        Queue TmpJobQ { get; set; }
        #endregion

        #region Public Methods  
        DataRow GetRecord(string INSTANCEID);
        void ExecuteAssignNewJob(MessageEx msg, bool IsCheckDataQuality);
        void Clear(DataRow dwThis, bool RemoveFromDataList = false);
        
        void ExecutePowerOn(object commandData);
        void LoadProcessing(string basetable);
       
        void ExecuteMachineReady(bool IsReady);
        void ExecuteKeyRelaitonComplete(DataSet setEvent);
        
        void ExecuteQualityCheck(object commandData);
        
        DataTable SetUpTableBase(DataSet setEvent, bool CheckDataQuality);
        /// <summary>
        /// Clear the view
        /// </summary>
        void Clear();
 
        /// <summary>
        /// The machine input buffer
        /// </summary>
        /// <param name="record">
        /// The record.
        /// </param>
        void InputJobPool(MessageEx msg); 
        /// <summary>
        /// The machine input buffer
        /// </summary>
        /// <param name="record">
        /// The record.
        /// </param>
        void OutputJobPool(MessageEx msg);
        /// <summary>
        /// The machine input buffer
        /// </summary>
        /// <param name="record">
        /// The record.
        /// </param>
        ExDataRow GetJob();  
                /// <summary>
        /// The machine input buffer
        /// </summary>
        /// <param name="record">
        /// The record.
        /// </param>
        bool CheckNewJob();  
     /// <summary>
        /// The ValidateJob
        /// </summary>
        /// <param name="record">
        /// The record.
        /// </param>
        bool ValidateJob(ExDataRow job);
             /// <summary>
        /// The ValidateForeignKey
        /// </summary>
        /// <param name="record">
        /// The record.
        /// </param>
        bool ValidateForeignKey(ExDataRow job,string foreignkey);
                     /// <summary>
        /// The LoadForeignKeyTable
        /// </summary>
        /// <param name="record">
        /// The record.
        /// </param>
        void LoadForeignKeyTable(ExDataRow dwThis);
        /// <summary>
        /// Enable the transition
        /// </summary>
        /// <param name="transition">
        /// The transition.
        /// </param>
        void EnableTransition(MachineTransition transition);

        /// <summary>
        /// The notify.
        /// </summary>
        /// <param name="transition">
        /// The atm Transition.
        /// </param>
        /// <param name="payload">
        /// The payload of the notification
        /// </param>
        void Notify(MachineTransition transition, object payload);

        /// <summary>
        /// Notifies the view model about Card Reader events
        /// </summary>
        /// <param name="readerResult">
        /// The reader result.
        /// </param>
        void Notify(BaseEvent readerResult);

        /// <summary>
        /// The display prompt.
        /// </summary>
        /// <param name="prompt">
        /// The prompt.
        /// </param>
        void Prompt(WFPrompt prompt);

        /// <summary>
        /// The display prompt.
        /// </summary>
        /// <param name="prompt">
        /// The prompt.
        /// </param>
        void SendMessage(MessageEx msg);

        /// <summary>
        /// The state changed.
        /// </summary>
        /// <param name="state">
        /// The state.
        /// </param>
        void StateChanged(string state);

        #endregion
    }
}